MowerDriverTestCase = TestCase("MowerDriverTestCase");

MowerDriverTestCase.prototype.testDriveMowers = function() {
	var lines = [
				"5 5",
				"1 2 N",
				"GAGAGAGAA",
				"3 3 E",
				"AADAADADDA"];
	var mowerFileInputReader = new MowerFileInputReader(null, null, null);
	mowerFileInputReader.lines = lines;
	
	var outputArr = new Array();
	var mowerDriver = new MowerDriver(mowerFileInputReader, function(mowerDriveResult) {
		outputArr.push(mowerDriveResult.toOutputString());
	});
	mowerDriver.driveMowers();
	
	assertEquals("1 3 N", outputArr[0]);
	assertEquals("5 1 E", outputArr[1]);
};

MowerDriverTestCase.prototype.testDriveMowersDriveOutsideLawn = function() {
	var lines = [
				"5 5",
				"1 1 N",
				"GAAADAA"];
	var mowerFileInputReader = new MowerFileInputReader(null, null, null);
	mowerFileInputReader.lines = lines;
	
	var outputArr = new Array();
	var mowerDriver = new MowerDriver(mowerFileInputReader, function(mowerDriveResult) {
		outputArr.push(mowerDriveResult.toOutputString());
	});
	mowerDriver.driveMowers();
	
	assertEquals("0 3 N", outputArr[0]);
};

MowerDriverTestCase.prototype.testDriveMowersPlaceOutsideLawn = function() {
	var lines = [
				"5 5",
				"7 1 N",
				"GAAADAA",
				"3 3 E",
				"AADAADADDA"];
	var mowerFileInputReader = new MowerFileInputReader(null, null, null);
	mowerFileInputReader.lines = lines;
	
	var outputArr = new Array();
	var mowerDriver = new MowerDriver(mowerFileInputReader, function(mowerDriveResult) {
		outputArr.push(mowerDriveResult.toOutputString());
	});
	mowerDriver.driveMowers();
	
	assertEquals("5 1 E", outputArr[0]);
};

MowerDriverTestCase.prototype.testDriveMowersInvalidCommand = function() {
	var lines = [
				"5 5",
				"1 2 N",
				"GAGAGAG?A",
				"3 3 E",
				"AADAADADDA"];
	var mowerFileInputReader = new MowerFileInputReader(null, null, null);
	mowerFileInputReader.lines = lines;
	
	var outputArr = new Array();
	var mowerDriver = new MowerDriver(mowerFileInputReader, function(mowerDriveResult) {
		outputArr.push(mowerDriveResult.toOutputString());
	});
	mowerDriver.driveMowers();
	
	assertEquals("1 2 N", outputArr[0]);
	assertEquals("5 1 E", outputArr[1]);
};

MowerDriverTestCase.prototype.testDriveMowersEmptyLines = function() {
	var lines = [
				"5 5",
				"1 2 N",
				"GAGAGAGAA",
				"",
				"3 3 E",
				"AADAADADDA"];
	var mowerFileInputReader = new MowerFileInputReader(null, null, null);
	mowerFileInputReader.lines = lines;
	
	var outputArr = new Array();
	var mowerDriver = new MowerDriver(mowerFileInputReader, function(mowerDriveResult) {
		outputArr.push(mowerDriveResult.toOutputString());
	});
	mowerDriver.driveMowers();
	
	assertEquals(1, outputArr.length);
	assertEquals("1 3 N", outputArr[0]);
};

